#ifndef ROLE_H
#define ROLE_H

#include <QObject>
#include <QGraphicsPixmapItem>
#include <QPropertyAnimation>
#include <QKeyEvent>

class role : public QObject,public QGraphicsPixmapItem
{
    Q_OBJECT
    Q_PROPERTY(QPointF pos READ getPos WRITE setPos1)
public:
    explicit role(QPixmap pixmap,QObject *parent = nullptr);
    void run();//人物跑动动画
    void jump();//跳跃动画
    //人物当前位置
    void KeyPressEvent(QKeyEvent *k);
    // bool keyPressEvent();

    void rolestart();

    QPointF getPos() const
    {
        return m_pos;
    }
    void setPos1(const QPointF &pos);


private:

    bool rundir;
    int runpos;
    qreal x;
    qreal y;
    QPropertyAnimation* rise;
    QPropertyAnimation* fall;
    QPointF m_pos;
    bool isJump;



//signals:
  //  void collidesignal2();
};


#endif // ROLE_H
